using Andromeda.Global.Business.DataObject;
using ForgeIt.Dal.dbo;
using System;

using System.Collections.Generic;
using System.Linq;
using Andromeda.Global.Data;

namespace ForgeIt.Business.Stub
{
	public abstract class EmployeeStub : DataObjectModelBase
	{
		#region private fields


		private DBEmployee foDBEmployee;

        private Entity localIdEntity;


		#endregion private fields
    
		#region public constructors

		protected EmployeeStub()
			: this(new DBEmployee())
		{
		}

        protected EmployeeStub(Entity foIdEntity)
          :this()
        {
            SetIdEntity(foIdEntity);
        }

		#endregion public constructors
    

		#region internal constructors

		internal EmployeeStub(DBEmployee foDBEmployee)
		{

			this.foDBEmployee = foDBEmployee;

		}

		#endregion internal constructors
  

		#region protected datasource properties
		

		internal DBEmployee DB_DBEmployee
		{
			get { return foDBEmployee ?? (foDBEmployee = new DBEmployee()); }
		}

		
		public override DataConnectorCollection DataObjects
		{
			get
			{
				return new DataConnectorCollection { foDBEmployee } ;
			}
		}

		

		/// 
		///
		/// 
		public int IdEmployee
		{
			get { return DB_DBEmployee.IdEmployee; }

		}

		/// 
		///
		/// 
		public int IdEntity
		{
			get { return DB_DBEmployee.IdEntity; }

			set { DB_DBEmployee.IdEntity = value; }

		}

		/// 
		///
		/// 
		public string Firstname
		{
			get { return DB_DBEmployee.Firstname; }

			set { DB_DBEmployee.Firstname = value; }

		}

		/// 
		///
		/// 
		public string Surname
		{
			get { return DB_DBEmployee.Surname; }

			set { DB_DBEmployee.Surname = value; }

		}

		#endregion protected datasource properties
    
		#region protected datasource foreign key properties
    

		///<summary>
		/// Getter method for obtainin a foreign key <see cref="Entity"/> object related to this object
		///</summary>
		public virtual Entity GetIdEntity()
		{
          return localIdEntity ?? (localIdEntity = new Entity(foDBEmployee.GetFK_IdEntity()));
		}
    

  		///<summary>
  		/// Setter method for linking this object to a foreign key object
  		///</summary>
  		///<param name="item">The <see cref="Entity"/> object to which we want to link our IdEntity</param>
  		public virtual void SetIdEntity(Entity item)
        {
          foDBEmployee.SetFK_IdEntity(item.DB_DBEntity);
          localIdEntity = new Entity(foDBEmployee.GetFK_IdEntity());
        }

  
		#endregion protected datasource foreign key properties
    
		#region protected datasource external key properties
    

  
		#endregion protected datasource external key properties
    
		#region properties
    

		#endregion properties
    
		#region methods methods

		#endregion methods

        #region Static Factories

        public static Employee GetEmployee(int foIdEmployee)
        {
          return new Employee(DBEmployee.GetEntity(foIdEmployee));
        }
  
        public static IEnumerable<Employee> ListEmployee()
        {
            return (from DBEmployee entity in DBEmployee.ListEntity() select new Employee(entity));
        }
        
  
        public static IEnumerable<Employee> ListEmployee(object foIdEmployee, object foIdEntity, object foFirstname, object foSurname)
        {
            return (from DBEmployee entity in DBEmployee.ListEntity(foIdEmployee, foIdEntity, foFirstname, foSurname) select new Employee(entity));
        }
        
        #endregion Static List Methods

	
  }
}